package sdk.webview.fmc.com.fmcsdk.check.adapter;



import android.annotation.SuppressLint;
import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import sdk.webview.fmc.com.fmcsdk.R;
import sdk.webview.fmc.com.fmcsdk.bean.DDTypeBean;
import sdk.webview.fmc.com.fmcsdk.check.bean.GetResultBean;
import sdk.webview.fmc.com.fmcsdk.util.KLog;

public class WorkResuAdapter extends BaseQuickAdapter<DDTypeBean.RecordsBean, BaseViewHolder> {
    public WorkResuAdapter(@Nullable List<DDTypeBean.RecordsBean> data) {
        super(R.layout.item_pause_work_result, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, DDTypeBean.RecordsBean item) {
        holder.setText(R.id.tv_result,item.getDescription());
        holder.setBackgroundRes(R.id.ll_item,item.isSelect()?R.color.color_ff4f5:R.color.white);
        holder.setTextColor(R.id.tv_result,item.isSelect()?Color.parseColor("#DC3C26"): Color.parseColor("#393A42"));
    }


    @SuppressLint("NotifyDataSetChanged")
    public void setSelect(int position){
        for (int i=0;i<getData().size();i++){
            getData().get(i).setSelect(false);
        }
        getData().get(position).setSelect(true);
        KLog.e(position);
        notifyDataSetChanged();
    }

}
